package boardgamer.yavalath.client;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.RectF;
import boardgamer.common.client.Button;
import boardgamer.common.client.ClickableButton;
import boardgamer.common.client.SimpleButton;
import boardgamer.common.client.layout.BitmapLayout;
import boardgamer.yavalath.client.resources.ImageHandler;

/**
 * @author garysoed
 */
public class GoButton implements Button {

  private ClickableButton innerButton;

  public GoButton(EventHandler eventHandler) {
    BitmapLayout goButtonDisplay = new BitmapLayout(ImageHandler.menuGoButton);
    RectF collisionRect = goButtonDisplay.getBoundingRect();
    collisionRect.inset(5, 5);
    this.innerButton = new ClickableButton(
        new SimpleButton(goButtonDisplay, eventHandler, collisionRect),
        GlowHex.horizontalHex(new BitmapLayout(ImageHandler.menuGoButton), Color.rgb(0, 196, 0)));
  }

  @Override
  public void draw(Canvas canvas) {
    innerButton.draw(canvas);
  }

  @Override
  public void handleEvent(float eventX, float eventY, int eventAction) {
    innerButton.handleEvent(eventX, eventY, eventAction);
  }

  @Override
  public RectF getCollisionBox() {
    return innerButton.getCollisionBox();
  }

  @Override
  public void setBoundingRect(RectF boundingRect) {
    innerButton.setBoundingRect(boundingRect);
  }

  @Override
  public RectF getBoundingRect() {
    return innerButton.getBoundingRect();
  }
}
